﻿@model LbangCMS.Areas.Admin.Models.SinglePageModel
@{
    ViewBag.Title = "EditPage";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@section nav{
    <li><a href="#">单页管理</a></li>
    <li class="active">@Model.Title</li>
}
<div class="panel">
    <form id="form" method="post" action="@Url.Action("EditPage","SinglePage")">
        <div class="panel-body">
            <div><input type="hidden" name="code" value="@Model.Code" /></div>
            <div>
                <textarea name="Body" rows="25" cols="80">@Model.Body</textarea>
            </div>
        </div>
    </form>
        <div class="panel-footer">
            <button class="btn btn-primary" onclick="submitForm('保存成功')">保存</button>
        </div>
   
</div>
@section script{
    <script src="~/Areas/Admin/content/libs/jquery/jquery-1.10.2.min.js"></script>
    <script src="~/Areas/Admin/content/libs/jquery/jquery.form.js"></script>
    <script src="~/Areas/Admin/content/libs/zui/js/zui.min.js"></script>
    <script src="~/Areas/Admin/content/libs/com.js"></script>
    <script src="~/Areas/Admin/content/libs/validate/jquery.validate.min.js"></script>
    <script src="~/Areas/Admin/content/libs/validate/additional-methods.min.js"></script>
    <script src="~/Areas/Admin/content/libs/validate/custom-additional-methods.js"></script>
    <script src="~/Areas/Admin/content/libs/validate/messages_zh.min.js"></script>
    <script src="~/Areas/Admin/Content/libs/zui/lib/kindeditor/kindeditor.min.js"></script>
    <script src="~/Areas/Admin/Content/libs/zui/lib/kindeditor/lang/zh_CN.js"></script>
    <script>
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[name="Body"]', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                width : '100%',
                items: [
                    'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                    'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                    'insertunorderedlist', '|', 'image','media', 'link']
            });
        });
        function submitForm(msg) {
            editor.sync()
            com.submitForm({
                isValid: true,
                $form: $("#form"),
                success: function (result) {
                    if (result.success) {
                       
                            layer.msg(msg);

                    } else {
                        layer.alert(result.errorMsg);
                    }
                }
            });
        }
    </script>
    }

